<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<script>
			"use strict"
			
			let promise = new Promise((resolve, reject) => {
				// 初始化 promise 状态: pending
				console.log("111")
				setTimeout(() => {
					console.log("333")
					// 根据异步任务的返回结果来去修改promise的状态
					// 异步任务执行成功
					resolve("O(∩_∩)O哈哈~") // 修改promise的状态为 fullfilled
					//异步任务执行失败
					// reject()
				}, 2000)
			})
			console.log("222")
			
			promise
				.then((data) => {
					console.log(`${data}, 成功了`)
				}, (error) => {
					console.log("失败了")
				})
			
		</script>
	</body>
</html>
